from pyspark import SparkConf, SparkContext

if __name__ == '__main__':
    # 构建SparkConf对象
    conf = SparkConf().setAppName("test").setMaster("local[*]")
    # 构建SparkContext执行环境入口对象
    sc = SparkContext(conf=conf)

    rdd = sc.parallelize(["a", "b", "c", "e", "d"])

    result = rdd.first()
    """
    first: 取出rdd内第一个元素
    """

    print(result)

    # 输出结果 a